<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:p="http://primefaces.org/ui">

<h:head>

</h:head>

<h:body>
	<ui:include src="menu.xhtml" />

	<h:form id="formLista" rendered="true">
		<p:messages for="formLista" autoUpdate="true" />
		<p:panel id="display" header="Voo" style="margin-top:10px;">
			<div align="center">
				<h:panelGrid columns="5">

					<h:outputLabel for="txtFiltroCodigoVoo" value="Código Voo" styleClass="createStaticField" />
					<h:outputLabel for="txtFiltroOrigemVoo" value="Origem" styleClass="createStaticField" />
					<h:outputLabel for="txtFiltroDestino" value="Destino" styleClass="createStaticField" />
					<h:outputLabel for="txtDataDecolagem" value="Data Decolagem" styleClass="createStaticField" />
					<h:outputLabel for="txtDataPouso" value="Data Pouso" styleClass="createStaticField" />


					<p:inputText id="txtFiltroCodigoVoo" styleClass="inputText" size="10" maxlength="30" value="#{vooMB.vooBeanFiltros.codigoVoo}" />


					<p:inputText id="txtFiltroOrigemVoo" styleClass="inputText" size="3" maxlength="3" value="#{vooMB.vooBeanFiltros.origemVoo}" />

					<p:inputText id="txtFiltroDestino" styleClass="inputText" size="3" maxlength="3" value="#{vooMB.vooBeanFiltros.destinoVo}" />

					<p:calendar timeZone="#{initParam.timezone}" value="#{vooMB.vooBeanFiltros.dataPrevistaDecolagem}" id="txtDataDecolagem" pattern="#{initParam.mascaraDataPadrao}" size="15" maxlength="15" />

					<p:calendar timeZone="#{initParam.timezone}" value="#{vooMB.vooBeanFiltros.dataPrevistaPouso}" id="txtDataPouso" pattern="#{initParam.mascaraDataPadrao}" maxlength="15" />


				</h:panelGrid>
			</div>
			<center>
				<p:commandButton value="Pesquisar" styleClass="button" update="lista" id="listagemBtPesquisar" action="#{vooMB.list}" />
				<p:commandButton styleClass="button" type="reset" value="Limpar" update="@form" id="btLimpar" />
			</center>



			<p:separator style="width:100%" />

			<h:commandLink id="linkIncluirEscritorio" action="createVoo" immediate="true">
				<p:graphicImage height="35px" value="/images/iconAdd.png" title="Incluir Novo">
				</p:graphicImage>
			</h:commandLink>

			<p:dataTable id="lista" var="voo" paginator="true" rows="20" value="#{vooMB.listaVooBean}">

				<p:column style="text-align:center; width: 30%" rendered="true">
					<f:facet name="header">Código Voo</f:facet>
					<h:outputText value="#{voo.codigoVoo}"></h:outputText>
				</p:column>

				<p:column style="text-align:center; width: 30%" rendered="true">
					<f:facet name="header">Origem</f:facet>
					<h:outputText value="#{voo.origemVoo}" />
				</p:column>

				<p:column style="text-align:center; width: 30%" rendered="true">
					<f:facet name="header">Destino</f:facet>
					<h:outputText value="#{voo.destinoVo}" />
				</p:column>

				<p:column style="text-align:center; width: 30%" rendered="true">
					<f:facet name="header">Data Decolagem</f:facet>
					<h:outputText value="#{voo.dataPrevistaDecolagem}">
						<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="#{initParam.timezone}" />
					</h:outputText>

				</p:column>

				<p:column style="text-align:center; width: 30%" rendered="true">
					<f:facet name="header">Data Pouso</f:facet>
					<h:outputText value="#{voo.dataPrevistaPouso}">
						<f:convertDateTime pattern="dd/MM/yyyy HH:mm" timeZone="#{initParam.timezone}" />
					</h:outputText>
				</p:column>

				<p:column style="text-align:center; width: 5%">
					<p:commandLink id="linkEditar" action="#{vooMB.showEdit}" ajax="false">
						<p:graphicImage height="20px" style="border:0;" value="/images/iconeEditar.png" title="Editar" />
						<f:setPropertyActionListener target="#{vooMB.vooBean}" value="#{voo}" />
					</p:commandLink>

					<p:commandLink id="linkVisualizar" action="#{vooMB.showView}" ajax="false">
						<p:graphicImage height="20px" style="border:0;" value="/images/iconeVisualizar.png" title="Exibir" />
						<f:setPropertyActionListener target="#{vooMB.vooBean}" value="#{voo}" />
					</p:commandLink>

					<p:commandLink id="linkExcluir" action="#{vooMB.delete}" onclick="return confirm('Confirma Exclusão ?');" update="lista">
						<p:graphicImage height="20px" style="border:0;" value="/images/iconeLixo.png" title="Excluir" />
						<f:setPropertyActionListener target="#{vooMB.vooBean}" value="#{voo}" />
					</p:commandLink>

					<p:commandLink id="linkAssentos" onclick="popupConfigurarAssentos.show();">
						<p:graphicImage height="20px" style="border:0;" value="/images/assento.png" title="Configuração de Assentos" />
						<f:setPropertyActionListener target="#{vooMB.vooBean}" value="#{voo}" />
					</p:commandLink>
				</p:column>
			</p:dataTable>
		</p:panel>
	</h:form>

	<ui:include src="popupGerarAssentos.xhtml"></ui:include>
</h:body>
</html>
